package com.briup.cms.web.controller;

import com.briup.cms.bean.RolePrivilege;
import com.briup.cms.bean.User;
import com.briup.cms.service.IRolePrivilegeService;
import com.briup.cms.utils.Message;
import com.briup.cms.utils.MessageUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


import java.util.List;

@Api(description = "角色管理接口")
@RestController
@RequestMapping("/role_privilege")
public class RolePrivilegeController {
    @Autowired
    private IRolePrivilegeService role_privilegeService;
    @ApiOperation("查询")
    @GetMapping("findAll")
    public Message findAll(){
    List<RolePrivilege> list=role_privilegeService.findAll();
    return MessageUtil.success(list);
    }
    @ApiOperation("保存或更新")
    @PostMapping("saveOrUpdate")
    public Message saveOrUpdate(RolePrivilege rolePrivilege){
        role_privilegeService.saveOrUpdate( rolePrivilege);
        return MessageUtil.success("保存成功");
    }

    @ApiOperation("删除")
    @GetMapping("deleteById")
    public Message deleteById(long id){
        role_privilegeService.deleteById(id);
        return  MessageUtil.success("删除成功");
    }
}